package com.online.fund.spider.dao;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import com.online.fund.spider.entity.FundAssetAllocation;
import com.online.fund.spider.entity.FundDetail;
import com.online.fund.spider.entity.FundShares;
import com.online.fund.spider.entity.IndustryPlate;
import com.online.fund.spider.entity.SharesIndustry;
import com.online.fund.spider.entity.SharesRefIdInfo;
import com.online.fund.spider.entity.SharesTransaction;

@Repository
@Mapper
public interface FundDao {

	/**
	 * 基金
	 * @param fundDetail
	 * @return
	 */
	public int addFund(FundDetail fundDetail);
	
	public int deleteFund(@Param("fundCode") String fundCode, @Param("crawlDate") String crawlDate);
	
	public int batchAddFundShares(@Param("fundSharesList") List<FundShares> fundSharesList);
	
	public int deleteFundShares(@Param("fundCode") String fundCode, @Param("statisticsDate") String statisticsDate);
	
	public int countFundShares(@Param("fundCode") String fundCode, @Param("statisticsDate") String statisticsDate);

	/**
	 * 删除基金资产配置
	 * @param fundCode
	 * @param statisticsDateList
	 */
	public int deleteFundAssetAllocation(@Param("fundCode") String fundCode, @Param("statisticsDateList") List<String> statisticsDateList);

	/**
	 * 批量插入基金资产配置
	 * @param assetAllocationList
	 */
	public int batchAddFundAssetAllocation(@Param("assetAllocationList")  List<FundAssetAllocation> assetAllocationList);
	
	/**
	 * 每天的股票交易数据
	 * @param crawlDate
	 * @param sharesTypeCode
	 * @return
	 */
	public int deleteSharesTransaction(@Param("crawlDate") String crawlDate, @Param("sharesTypeCode") String sharesTypeCode);
	
	/**
	 * 批量股票交易数据
	 * @param assetAllocationList
	 */
	public int batchAddSharesTransaction(@Param("sharesTransactionList")  List<SharesTransaction> sharesTransactionList);
	
	/**
	 * 根据深证、上证查询对应的股票
	 * @return
	 */
	public List<SharesTransaction> querySharesTransactionByTypeCode(@Param("sharesTypeCode") String sharesTypeCode);

	/**
	 * 批量插入到股票行业表中
	 * @param sharesIndustryList
	 */
	public void batchAddSharesIndustry(@Param("sharesIndustryList") List<SharesIndustry> sharesIndustryList); 
	
	/**
	 * 删除行业板块的数据
	 * @param crawlDate
	 * @return
	 */
	public int deleteIndustryPlate(@Param("crawlDate") String crawlDate);
	
	/**
	 * 批量插入行业板块的数据
	 * @param industryPlateList
	 */
	public void batchAddIndustryPlate(@Param("industryPlateList") List<IndustryPlate> industryPlateList);

	/**
	 * 删除股票相关数据
	 * @param sharesTypeCode
	 */
	public void deleteSharesRefIdInfo(String sharesTypeCode);

	/**
	 * 批量添加股票编码数据
	 * @param sharesRefIdInfoList
	 */
	public void batchAddSharesRefIdInfoList(@Param("sharesRefIdInfoList") List<SharesRefIdInfo> sharesRefIdInfoList); 
}
